<template>
  <div class="app-container">
    <editor v-loading="loading" v-model="companyProfile" height="75vh" style="border: 1px #DCDFE6 solid;width: 100%;"/>
    <div style="width: 80%;margin: 0 auto;text-align: right;padding-top: 10px">
      <el-button type="warning" plain @click="submitCompanyProfile">提 交</el-button>
    </div>
  </div>
</template>

<script>
import {getJiayi_about_us_company_profile,updateJiayi_about_us} from "@/api/cms/jiayi_about_us";
import {isEmptyStr} from "@/utils/zzDouUtils/objUtil";

export default {
  name: "Jiayi_about_us__company_profile",
  data() {
    return {
      loading: false,
      form: {},
      companyProfile: null,
    };
  },
  created() {
    this.getCompanyProfile();
  },
  methods: {
    getCompanyProfile(){
      this.loading = true;
      getJiayi_about_us_company_profile().then(response=>{
        this.form = response.data;
        this.companyProfile = response.data.valueObj;
        this.loading = false;
      })
    },
    submitCompanyProfile(){
      if (isEmptyStr(this.companyProfile)){
        this.$modal.msgError("内容不可为空");
        return;
      }
      this.form.valueObj = this.companyProfile;
      updateJiayi_about_us(this.form).then(response=>{
        this.$modal.msgSuccess("修改成功");
        this.getCompanyProfile();
      })
    }
  }
};
</script>
<style scoped>

</style>
